-
-
Notifications
You must be signed in to change notification settings - Fork 702
fix the infinite loop in lie algebra #41200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Updated test documentation for morphism construction to clarify error handling.
|
the fix is too special-cased (special-casing is usually bad, users expect uniform behavior, plus it introduces more bloats in the code) and doesn't address the root cause of the problem. Need more careful thinking. What about |
I think just check parent is fragile. So I add coerce check in this case. I think It just need a base case to let the algorithm to jump out to the infinite loop |
Solutions
This fixes #40780
Add an explicit check in
_element_constructor_to handle vectors directly usingfrom_vector()before attempting to useself._assoc(x):📝 Checklist
The Infinite Loop Cycle
The infinite recursion occurs in the following cycle:
Detailed Breakdown
Morphism Construction Context:
gl.morphism({e:e for e in gl.gens()}), the morphism code (inmorphism.py) computes brackets to extend the spanning setdomain.bracket(spanning_set[i], spanning_set[j])wherespanning_setcontains vectorsBracket Computation:
bracketmethod inlie_algebras.pyline 290:lhs,rhs) to Lie algebra elements by callingself(vector)Element Constructor Issue:
LieAlgebraFromAssociative._element_constructor_(line 1246) was:xis a vector, it callsself._assoc(vector)Coercion Map Problem:
self._associs aMatrixSpaceLiftMorphismToAssociativewas set up as a coercionThe Loop Closes:
MatrixSpace(vector)uses the coercion mapVectorSpace → LieAlgebracallsgl(vector)_element_constructor_again with the same vector⌛ Dependencies